package ru.megazlo.basemvc.viewmodel;

import org.hibernate.validator.constraints.Email;

import javax.validation.constraints.Size;

@FieldMatch.List({
		@FieldMatch(first = "password", second = "confirmPassword", message = "Пароли должны совпадать.")
})
public class RegisterUser {
	@Size(min = 3, max = 30)
	private String login;

	@Email
	private String email;

	@Size(min = 4, max = 30)
	private String password;

	@Size(min = 4, max = 30)
	private String confirmPassword;

	/*@AssertTrue(message = "Пароли должны совпадать.")
	private boolean isPasswordValid() {
		return password != null && password.equals(confirmPassword);
	}
*/
	public String getLogin() {
		return login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getConfirmPassword() {
		return confirmPassword;
	}

	public void setConfirmPassword(String confirmPassword) {
		this.confirmPassword = confirmPassword;
	}
}
